-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Infrastructure: sceNetInet and sceNetResolver support. #18578
base: master
Are you sure you want to change the base?
WIP: Infrastructure: sceNetInet and sceNetResolver support. #18578
Conversation
Core/HLE/sceNetInet.cpp
Outdated
if (error != ERROR_WHEN_NONBLOCKING_CALL_OCCURS && error != 0) { | ||
INFO_LOG(SCENET, "Requested sceNetInetGetErrno %i=%s", error, strerror(error)); | ||
} | ||
switch (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Create a map for O(1) lookups.
|
||
int sceNetInetTerm() { | ||
ERROR_LOG(SCENET, "UNTESTED sceNetInetTerm()"); | ||
SceNetInet::Shutdown(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Figure out why CLion felt like using tabs instead of spaces ......
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was just gonna comment on that :D
This is, of course, extremely cool! Nice job! |
static constexpr int gFdsBitsCount = 8 * static_cast<int>(sizeof(fdMask)); | ||
|
||
struct FdSet { | ||
fdMask mFdsBits[256 / gFdsBitsCount]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: document 256 being max FD_SET size for PSP
#pragma comment(lib, "ws2_32.lib") | ||
#define close closesocket | ||
#define ERROR_WHEN_NONBLOCKING_CALL_OCCURS WSAEWOULDBLOCK | ||
using netBufferType = char; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: document why this is necessary, C++ reinterpret_cast dealing with differing C headers between winsock and sane POSIX sockets implementations
Don't you mean the other way around? It uses spaces now, while the rest of the project and probably most of us in general uses tabs. |
I actually did mean what I said, but I realized after I posted that tabs was in fact used for this project. I am just too used to spaces instead of tabs 😅. I'll make sure that that is fixed. |
PSP only supports socket id/file descriptors of 0 to 255 (8 bits), some games even use the lowest 8-bit value only, if you use Windows's socket fd directly without mapping it to [0..255] many games will be facing crashes (due to out of bound access during FD_SET/etc. by the game) and inaccuracy during You should create a socket objects and map the id there, you will also need to store non-blocking information and implement a simulation of blocking behavior instead of using blocking mode directly (which will blocks the emulation). |
Thanks for that, I think I saw similar comments by you (and others) elsewhere and so that's what I've done.
If you have any examples of such games please let me know because I'd like to validate its robustness as much as possible. |
I'll upload my stashed code later after i fixes the conflicts with the latest master, it probably not the latest one i had, since i couldn't found the latest one where i already fix the conflicts and separating the NetResolver out. (Edit: Looks like NetResolver has been separated out from this stashed code, but still have the sceHttp included) Anyway, you can use my stashed code as reference if you want, as i already implement nearly all the Inet syscalls (i think i only missing the Edit: ugh i'm facing an error i don't know how to resolve after i'm done fixing the conflicts.
PS: i'm using a fresh installation of Win11Pro 23H2 + Visual Studio Community 2022 (Desktop C++ Dev & UWP components) + Python 3.12.1, did i missed anything else? Edit2: Oops i forgot that i use the embedded version of git in Sourcetree, thus not in the PATH env var (didn't know that the build process will calls |
Thanks for that! You don't need to resolve conflicts etc I can handle cherry-picking it in even if its just a patch file and include you as a co-author, if that works for you? I plan to resume working on this weekend which is when my vacation starts. |
Thank you! I should be able to get this PR updated against it this weekend and then move onto fixing all the builds.. |
62ef20b
to
fe8d0c3
Compare
Co-authored-by: AdamN <[email protected]>
fe8d0c3
to
4ddf3ea
Compare
…mes impl and begin converting ERROR_LOGS into hleLogError + ensuring last error is set.
e885c54
to
8cd4a65
Compare
c1dad25
to
d49c3ec
Compare
Is this in a state where we can just get it in as-is, without breaking other stuff? Got a report that it works fine for Wipeout Pulse and that community are going to use it through their own builds regardless, heh. (Yeah, the description says it's a bit wonky on Windows, but it might be okay) |
This is not the build we use for Pulse. We use https://github.com/anr2me/ppsspp/tree/infra2 instead. Specifically the infra2 branch. |
That mean it's PR anr2me#21 Even though my code have more syscalls implementation that this PR, but it's not well written (ugly) compared to this. |
@anr2me Then maybe it makes sense to merge this soon, and then for you to rework your PR on top? Or what do you think? |
I'm afraid i'm no longer working on network stuff, not even adhoc stuff. |
Ah yeah, that's totally understandable of course. In that case, the best next step might be to just get this in (after the 1.18 release) |
Description
Support infrastructure mode in some(?) games by implementing a portion of the sceNetInet and sceNetResolver modules. Haven't tested for longer than 5 mins in game but I don't think there are memory issues etc, it is a fairly straightforward shim.
Summary of changes made
Changes yet to make
Caveats, assumptions, callouts